package com.boatAnchorAssistant.service.controller.test;

import com.boatAnchorAssistant.pojo.vo.login.TokenVo;
import com.boatAnchorAssistant.service.service.in.LoginService;
import nirvana.core.domains.vo.ApiResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * test/登录
 * 【描 述】：
 * 【环 境】：J2SE 17
 * 【详 细】：
 *
 * @author 李松林
 * @version v1.0 2024/5/3 新建
 * @since 2024/5/3
 */
@RestController
@RequestMapping(value = "/login/test")
public class LoginTestController {

    private final LoginService loginService;

    public LoginTestController(LoginService loginService) {
        this.loginService = loginService;
    }


    /**
     * id获取token
     *
     * 要求用户是正常用户
     *
     * 即启用中，且未被删除，任在有效期内
     * @param id
     * @return
     */
    @GetMapping("/idLogin")
    public ApiResult<TokenVo> testIdLogin(@RequestParam("id")Long id) {
        TokenVo vo = loginService.testIdLogin(id);
        return ApiResult.ok (vo);
    }

}
